<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 17-11-6
 * Time: 下午2:40
 */

namespace common\models\credit_app;

/**
 * Class OrderCar
 * @package common\models\credit_app
 *
 * @property Order $order
 */
class OrderCar extends \common\models\credit_app_tables\OrderCar
{
    public static $serialize_fields = [
        'ot_calculated',
        'ot_carcard_img',
        'ot_carfare_img',
        'ot_getcar_img',
    ];

    /**
     * @param $id
     * @return null|static
     */
    public static function findActiveOneById($id)
    {
        return static::findOne(['ot_id'=>$id]);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getOrder()
    {
        return $this->hasOne(Order::className(), ['o_id' => 'ct_oid']);
    }
}